package com.yuexunit.operationman.nbsy.module.SafeOperation.ui;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.yuexunit.operationman.nbsy.R;
import com.yuexunit.operationman.nbsy.base.ExitApplication;
import com.yuexunit.operationman.nbsy.config.AppConfig;
import com.yuexunit.operationman.nbsy.module.SafeOperation.ui.fragment.Fragment_SO_BeforeLeave;
import com.yuexunit.operationman.nbsy.module.SafeOperation.ui.fragment.Fragment_SO_BeforeNarcosis;
import com.yuexunit.operationman.nbsy.module.SafeOperation.ui.fragment.Fragment_SO_BeforeOperation;

import org.kymjs.kjframe.KJActivity;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by chenss on 2017/7/7 0007.
 */

public class Act_SafeOperation_Preview extends KJActivity {


    @Bind(R.id.tv_patient_name)
    TextView tvPatientName;
    @Bind(R.id.tv_patient_sex)
    TextView tvPatientSex;
    @Bind(R.id.tv_patient_visitno)
    TextView tvPatientVisitno;
    @Bind(R.id.tv_patient_disease)
    TextView tvPatientDisease;
    @Bind(R.id.safeoperation_preview_img_01)
    ImageView safeoperationPreviewImg01;
    @Bind(R.id.safeoperation_preview_img_02)
    ImageView safeoperationPreviewImg02;
    @Bind(R.id.safeoperation_preview_img_03)
    ImageView safeoperationPreviewImg03;

    Fragment_SO_BeforeNarcosis fragment_so_beforeNarcosis;
    Fragment_SO_BeforeOperation fragment_so_beforeOperation;
    Fragment_SO_BeforeLeave fragment_so_beforeLeave;

    @Override
    public void setRootView() {
        setContentView(R.layout.act_safeoperation_preview);
        ButterKnife.bind(this);
        ExitApplication.getInstance().addActivity(this);
    }

    @Override
    public void initData() {
        super.initData();
        fragment_so_beforeNarcosis = new Fragment_SO_BeforeNarcosis();
        fragment_so_beforeOperation = new Fragment_SO_BeforeOperation();
        fragment_so_beforeLeave = new Fragment_SO_BeforeLeave();
        changeFragment(R.id.content, fragment_so_beforeNarcosis);
        setTitle();
    }

    private void setTitle()
    {
        tvPatientName.setText(AppConfig.SAFEOPERATIONBEAN.getObject().getSecurity().getPatientName());
        if(AppConfig.SAFEOPERATIONBEAN.getObject().getSecurity().getPatientSex().equals("1")) {
            tvPatientSex.setText("男");
        }else if(AppConfig.SAFEOPERATIONBEAN.getObject().getSecurity().getPatientSex().equals("2"))
        {
            tvPatientSex.setText("女");
        }
        else {
            tvPatientSex.setText("不详");
        }
        tvPatientVisitno.setText("住院号" + AppConfig.SAFEOPERATIONBEAN.getObject().getSecurity().getInHospitalNo());
        tvPatientDisease.setText(AppConfig.SAFEOPERATIONBEAN.getObject().getSecurity().getOperandi());
    }


    @OnClick({R.id.titlebar_docadvice_img_back, R.id.tv_submit, R.id.safeoperation_preview_ll_01, R.id.safeoperation_preview_ll_02, R.id.safeoperation_preview_ll_03})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.titlebar_docadvice_img_back:
                finish();
                break;
            case R.id.tv_submit:
                break;
            case R.id.safeoperation_preview_ll_01:
                safeoperationPreviewImg01.setVisibility(View.VISIBLE);
                safeoperationPreviewImg02.setVisibility(View.INVISIBLE);
                safeoperationPreviewImg03.setVisibility(View.INVISIBLE);
                changeFragment(R.id.content, fragment_so_beforeNarcosis);
                break;
            case R.id.safeoperation_preview_ll_02:
                safeoperationPreviewImg01.setVisibility(View.INVISIBLE);
                safeoperationPreviewImg02.setVisibility(View.VISIBLE);
                safeoperationPreviewImg03.setVisibility(View.INVISIBLE);
                changeFragment(R.id.content, fragment_so_beforeOperation);
                break;
            case R.id.safeoperation_preview_ll_03:
                safeoperationPreviewImg01.setVisibility(View.INVISIBLE);
                safeoperationPreviewImg02.setVisibility(View.INVISIBLE);
                safeoperationPreviewImg03.setVisibility(View.VISIBLE);
                changeFragment(R.id.content, fragment_so_beforeLeave);
                break;
        }
    }
}
